<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{baseui/head :: head}">
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="description" content="牧中智慧畜牧大数据云平台"/>
    <meta name="author" content="牧中(上海)物联网科技有限公司"/>
    <link rel="shortcut icon" href="/webjars/images/favicon.png"/>

    <title>牧中智慧畜牧大数据云平台V1.0</title>


</head>
<body>
<!--顶部一级导航-->
<th:block th:replace="baseui/topheader :: topheader(1)"/>

<!--动检通菜单-->
<th:block th:replace="djt/partial/topnav :: topnav(1)"/>


<div id="cl-wrapper">
    <div class="container-fluid" id="pcont">


        <div class="cl-mcont">

            <div class="row">
                <div class="col-sm-6 col-md-6">
                    <!--产地检疫总体情况-->
                    <div class="block-flat">
                        <div class="header">


                            <div class="btn-group pull-right">
                                <button id="cdday" type="button" class="btn btn-default">本日</button>
                                <button id="cdweek" type="button" class="btn btn-default">本周</button>
                                <button id="cdmonth" type="button" class="btn btn-default">本月</button>
                            </div>
                            <br/>
                            <h4>产地检疫总体情况</h4>

                        </div>
                        <div style="height: 17px;width: 400px;"></div>
                        <div class="content">


                            <div class="content no-padding">

                                <div class="fact-data text-center" >

                                    <h3 ><i class="fa fa-arrow-circle-o-right color-primary"></i>发起检疫申请数(次)</h3>

                                    <span id="jyshenqing" style="font-size: 30px; line-height: 60px;">1,572</span>
                                </div>
                                <div class="fact-data text-center">

                                    <h3><i class="fa fa-arrow-circle-o-right color-danger"></i>动物申报数量(头)</h3>

                                    <span id="dwshuliang" style="font-size: 30px; line-height: 60px;">2,372,348</span>
                                </div>
                            </div>
                            <div style="height: 20px;width: 400px;"></div>

                            <div class="content no-padding">

                                <table class="no-border hover">
                                    <thead class="no-border">
                                    <tr>
                                        <th style="width:40%;">类型</th>
                                        <th>数量</th>
                                        <th>占比</th>
                                        <th>同比</th>
                                        <th class="text-right">环比</th>
                                    </tr>
                                    </thead>
                                    <tbody class="no-border-y">
                                    <tr>
                                        <td style="width:30%;"><i class="fa fa-thumb-tack"></i>本地屠宰</td>
                                        <td id="bdtuzai">172,348</td>
                                        <td id="bdzb">51.94%</td>
                                        <td id="bdtb">51.94%</td>
                                        <td id="bdcolor" class="text-right color-success"><i id="bdclass"
                                                                                             class="fa fa-angle-up"></i><span
                                                id="bdhb">48%</span></td>
                                    </tr>
                                    <tr>
                                        <td style="width:30%;"><i class="fa fa-mail-forward"></i> 销往外市</td>
                                        <td id="wsshuliang">124,621</td>
                                        <td id="wszb">51.94%</td>
                                        <td id="wstb">51.94%</td>
                                        <td id="wscolor" class="text-right color-danger"><i id="wsclass"
                                                                                            class="fa fa-angle-down"></i><span
                                                id="wshb">48%</span></td>
                                    </tr>
                                    <tr>
                                        <td style="width:30%;"><i class="fa fa-check-square-o"></i> 合格数</td>
                                        <td id="qualified">172,348</td>
                                        <td id="hgzb">51.94%</td>
                                        <td id="qutb">51.94%</td>
                                        <td id="hgcolor" class="text-right color-primary"><i id="hgclass"
                                                                                             class="fa fa-angle-right"></i><span
                                                id="quhb">48%</span></td>
                                    </tr>
                                    <tr>
                                        <td style="width:30%;"><i class="fa fa-ban"></i> 不合格数</td>
                                        <td id="unqualified">8</td>
                                        <td id="unzb">13</td>
                                        <td id="untb">51.94%</td>
                                        <td id="bhgcolor" class="text-right color-primary"><i id="bhgclass"
                                                                                              class="fa fa-angle-right"></i><span
                                                id="unhb">48%</span></td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>

                        </div>
                    </div>
                    <!--屠宰检疫总体情况-->
                    <!--        <div class="block-flat">
                                <div class="header">
                                    <div class="btn-group pull-right">
                                        <button id="tzday" type="button" class="btn btn-default">本日</button>
                                        <button id="tzweek" type="button" class="btn btn-default">本周</button>
                                        <button id="tzmonth" type="button" class="btn btn-default">本月</button>
                                    </div>
                                    <br />
                                    <h4>屠宰检疫总体情况</h4></div>
                                <div class="content">

                                    <div class="content no-padding">

                                        <div class="fact-data text-center">

                                            <h3><i class="fa fa-bookmark-o color-primary"></i>发起屠宰申请数(次)</h3>
                                            <h2 id="tzsq">1,572</h2>
                                        </div>
                                        <div class="fact-data text-center">

                                            <h3><i class="fa fa-bookmark-o color-danger"></i>动物屠宰数量(头)</h3>
                                            <h2 id="tzshuliang">2,372,348</h2>
                                        </div>
                                    </div>


                                    <div class="content no-padding">

                                        <table class="no-border hover">
                                            <thead class="no-border">
                                            <tr>
                                                <th style="width:40%;">类型</th>
                                                <th>数量</th>
                                                <th>占比</th>
                                                <th>同比</th>
                                                <th class="text-right">环比</th>
                                            </tr>
                                            </thead>
                                            <tbody class="no-border-y">
                                            <tr>
                                                <td style="width:30%;"><i class="fa fa-thumb-tack"></i>本地屠宰</td>
                                                <td id="bdtz">172,348</td>
                                                <td id="tzbdzb">51.94%</td>
                                                <td id="tzbdtb">51.94%</td>
                                                <td id="tzbdcolor" class="text-right color-success"><i id="tzbdclass"
                                                                                                       class="fa fa-angle-up"></i><span
                                                        id="tzbdhb"></span></td>
                                            </tr>
                                            <tr>
                                                <td style="width:30%;"><i class="fa fa-mail-forward"></i> 外地入场</td>
                                                <td id="wdrc">124,621</td>
                                                <td id="tzwdzb">51.94%</td>
                                                <td id="tzwdtb">51.94%</td>
                                                <td id="tzwdcolor" class="text-right color-danger"><i id="tzwdclass"
                                                                                                      class="fa fa-angle-down"></i><span
                                                        id="tzwdhb"></span></td>
                                            </tr>
                                            <tr>
                                                <td style="width:30%;"><i class="fa fa-check-square-o"></i> 合格数</td>
                                                <td id="tzhg">172,348</td>
                                                <td id="tzhgzb">51.94%</td>
                                                <td id="tzhgtb">51.94%</td>
                                                <td id="tzhgcolor" class="text-right color-primary"><i id="tzhgclass"
                                                                                                       class="fa fa-angle-right"></i><span
                                                        id="tzhghb"></span></td>
                                            </tr>
                                            <tr>
                                                <td style="width:30%;"><i class="fa fa-ban"></i> 不合格数</td>
                                                <td id="tzbhg">8</td>
                                                <td id="tzbhgzb">13</td>
                                                <td id="tzbhgtb">51.94%</td>
                                                <td id="tzbhgcolor" class="text-right color-primary"><i id="tzbhgclass"
                                                                                                        class="fa fa-angle-right"></i><span
                                                        id="tzbhghb"></span></td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>

                                </div>
                            </div>-->

                </div>
                <!--实时存栏量无害化-->
                <div class="col-sm-6 col-md-6">
                    <div class="block-flat">
                        <div class="header"><h4>实时存栏量</h4></div>
                        <div class="content">
                            <div id="realamountChart" style="width: 540px;height:360px;"></div>
                        </div>
                    </div>
                    <br/><br/>
                </div>


            </div>
                <div class="row">
                <div style="width: 1300px;height:450px ;margin-left: 11px">
                    <div class="block-flat">
                        <div class="header"><h4>无害化一周处理趋势图</h4></div>
                        <div class="content">
                            <div id="harmlessChart" style="width: 1000px;height:330px;"></div>
                        </div>

                    </div>
                </div>
            </div>

            <!--预警信息-->
            <!-- <div class="row" hidden="hidden">
                 <div class="col-md-12">
                     <div class="block-flat">
                         <div class="header">
                             <h4>预警信息</h4>

                         </div>
                         <div class="content">

                             <div class="row">

                                 <div class="col-md-6 col-sm-6">
                                     &lt;!&ndash;执法办案&ndash;&gt;
                                     <div class="block-flat">
                                         <div class="header">

                                             <div class="pull-right">
                                                 <button type="button" id="supermore" class="btn btn-success btn-xs"><i
                                                         class="fa fa-mail-forward"></i> 更多
                                                 </button>

                                             </div>
                                             <h4>执法办案</h4>

                                         </div>


                                         <div class="content">
                                             <table class="no-border blue">
                                                 <thead class="no-border">
                                                 <tr>
                                                     <th>序号</th>
                                                     <th>区域</th>
                                                     <th hidden="hidden">信息分类</th>
                                                     <th style="width:30%;">详细</th>
                                                     <th hidden="hidden" class="text-right">预警等级</th>
                                                 </tr>
                                                 </thead>
                                                 <tbody class="no-border-x" id="superyujing">
                                                 <tr>
                                                     <td>1</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right color-danger">高级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>2</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>3</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>4</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>5</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 </tbody>
                                             </table>

                                         </div>

                                     </div>


                                 </div>

                                 <div class="col-md-6 col-sm-6">
                                     &lt;!&ndash;无害化处理&ndash;&gt;
                                     <div class="block-flat">
                                         <div class="header">
                                             <div class="pull-right">
                                                 <button type="button" id="harmlessmore" class="btn btn-success btn-xs"><i
                                                         class="fa fa-mail-forward"></i> 更多
                                                 </button>
                                             </div>
                                             <h4>无害化处理</h4>

                                         </div>
                                         <div class="content">

                                             <table class="no-border blue">
                                                 <thead class="no-border">
                                                 <tr>
                                                     <th>序号</th>
                                                     <th>区域</th>
                                                     <th>信息分类</th>
                                                     <th style="width:30%;">详细</th>
                                                     <th class="text-right" hidden="hidden">预警等级</th>
                                                 </tr>
                                                 </thead>
                                                 <tbody class="no-border-x" id="harmlessyujing">
                                                 <tr>
                                                     <td>1</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>2</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="color-warning text-right">中级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>3</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>4</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 <tr>
                                                     <td>5</td>
                                                     <td>上海 金山</td>
                                                     <td>疫情</td>
                                                     <td>发生蓝耳病疫情</td>
                                                     <td class="text-right">初级</td>
                                                 </tr>
                                                 </tbody>
                                             </table>

                                         </div>

                                     </div>
                                 </div>

                             </div>

                         </div>

                     </div>


                 </div>
             </div>-->

            <!--畜产品追溯-->
            <div class="row">
                <div class="col-md-12">
                    <div class="block-flat">
                        <div class="header">
                            <h4>畜产品溯源</h4>


                        </div>
                        <div class="content">

                            <div class="row">

                                <form action="#" novalidate="" class="form-horizontal group-border-dashed">
                                    <div class="form-group"><label class="col-sm-3 control-label">按养殖场追溯</label>

                                        <div class="col-sm-6">


                                            <div class="col-sm-3">
                                                <select class="select2">
                                                    <option value="所有区域">所有区域</option>
                                                    <optgroup label="襄阳市">
                                                        <option value="南漳县">南漳县</option>
                                                        <option value="其它县">其它县</option>
                                                    </optgroup>
                                                </select>
                                            </div>
                                            <div class="col-sm-3">

                                                <select class="select2">
                                                    <option value="所有区域">所有区域</option>
                                                    <optgroup label="南漳县">
                                                        <option value="九集镇">九集镇</option>
                                                        <option value="其它镇">其它镇</option>
                                                    </optgroup>

                                                </select>

                                            </div>
                                            <div class="col-sm-6">
                                                <select class="select2">

                                                    <option value="养殖场名称">养殖场名称</option>

                                                </select>
                                            </div>


                                        </div>

                                        <div class="col-sm-3">
                                            <button type="button" class="btn btn-primary">确定</button>
                                        </div>

                                    </div>


                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">按耳标号追溯</label>
                                        <div class="col-sm-6"><input type="text" placeholder="请输入耳标号"
                                                                     class="form-control"></div>
                                        <div class="col-sm-3">
                                            <button type="button" class="btn btn-primary">确定</button>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">按证号追溯</label>
                                        <div class="col-sm-6"><input type="text" placeholder="请输入AB证号"
                                                                     class="form-control"></div>
                                        <div class="col-sm-3">
                                            <button type="button" class="btn btn-primary">确定</button>
                                        </div>
                                    </div>

                                </form>

                            </div>

                        </div>

                    </div>


                </div>
            </div>
            <!--end-->
        </div>
    </div>

</div>

<script type="text/javascript" src="/webjars/js/jquery.js"></script>


<script type="text/javascript" src="/webjars/js/jquery.nanoscroller/jquery.nanoscroller.js"></script>
<script type="text/javascript" src="/webjars/js/behaviour/general.js"></script>
<script src="/webjars/js/jquery.ui/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript" src="/webjars/js/jquery.nestable/jquery.nestable.js"></script>

<script type="text/javascript" src="/webjars/js/bootstrap.switch/bootstrap-switch.min.js"></script>
<script type="text/javascript"
        src="/webjars/js/bootstrap.datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script src="//cdn.bootcss.com/select2/3.4.5/select2.min.js" type="text/javascript"></script>

<script src="/webjars/js/bootstrap.slider/js/bootstrap-slider.js" type="text/javascript"></script>
<script type="text/javascript" src="/webjars/js/jquery.niftymodals/js/jquery.modalEffects.js"></script>
<script type="text/javascript" src="/webjars/js/jquery.magnific-popup/dist/jquery.magnific-popup.min.js"></script>

<script src="/webjars/js/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="//cdn.bootcss.com/echarts/3.6.2/echarts.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        App.init();


    });
</script>

<script type="text/javascript">

    /* function ducha() {
     $.ajax({

     url: '/djt/inspector/recordsindex',
     dataType: 'json',
     async: false,
     success: function (data) {
     /!**!/

     for (var i = 0; i < data.length; i++) {


     }


     }
     });
     }

     function ducha() {
     $.ajax({

     url: '/djt/harmless/wuhaihua',
     dataType: 'json',
     async: false,
     success: function (data) {
     $("#harmlessyujing").html("");
     /!*<tr>
     <td>1</td>
     <td>上海 金山</td>
     <td>疫情</td>
     <td>发生蓝耳病疫情</td>
     <td class="text-right">初级</td>
     </tr>*!/
     var str = "";
     var num = index + 1;
     $.each(data, function (index, item) {
     for (var key in item) {
     str += "<tr>" +
     "<td>" + num + "</td>" +
     "<td>" + key + "</td>" +
     "<td>" + itme[key].treatment + "</td>" +
     "<td>" + item[key].remark + "</td>" +
     "</tr>"
     }
     $("#harmlessyujing").append(str);
     str = "";
     })


     }
     });
     }
     */
    function t5() {

        var array = new Array();
        var array1 = new Array();
        var array2 = new Array();
        var array3 = new Array();
        var array4 = new Array();
        var array5 = new Array();

        $.ajax({

            url: '/djt/breedarch/dashboardchert',
            dataType: 'json',
            async: false,
            success: function (data) {

                for (var i = 0; i < data.length; i++) {

                    array1.push(data[i].city);
                    array2.push(data[i].Stock1);
                    array3.push(data[i].Stock2);
                    array4.push(data[i].Stock3);
                    array5.push(data[i].Stock4);
                }


            }
        });
        array1.push("总存栏量(万)");
        var a1 = 0;
        for (var i = 0; i < array2.length; i++) {
            a1 += array2[i];
        }
        array2.push(a1);
        var a2 = 0;
        for (var j = 0; j < array3.length; j++) {
            a2 += array3[j];
        }
        array3.push(a2);
        var a3 = 0;
        for (var m = 0; m < array4.length; m++) {
            a3 += array4[m];
        }
        array4.push(a3);

        var a4 = 0;
        for (var n = 0; n < array5.length; n++) {
            a4 += array5[n];
        }
        array5.push(a4);

        array.push(array1);
        array.push(array2);
        array.push(array3);
        array.push(array4);
        array.push(array5);

        return array;

    }
    var t5 = t5();
    // ------实时存栏量-----
    var realamountChart = echarts.init(document.getElementById('realamountChart'));

    // 实时存栏量
    option = {

        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            data: ['猪', '牛', '羊', '家禽'],
            selected: {
                '家禽': false
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: {
            type: 'value',
            boundaryGap: [0, 0.01]
        },
        yAxis: {
            type: 'category',
            data: t5[0]
        },
        series: [
            {
                name: '猪',
                type: 'bar',
                data: t5[1]
            },
            {
                name: '牛',
                type: 'bar',
                data: t5[2]
            }
            ,
            {
                name: '羊',
                type: 'bar',
                data: t5[3]
            }
            ,
            {
                name: '家禽',
                type: 'bar',
                data: t5[4]
            }
        ]
    };


    // 实时存栏量。
    realamountChart.setOption(option);

    function all(map) {
        return Number(map[1]) + Number(map[2]) + Number(map[3]) + Number(map[4]) + Number(map[5]) + Number(map[6]);
    }
    //--------------------无害化处理趋势图------------------------------

    function formatDate(date) {
        var myyear = date.getFullYear();
        var mymonth = date.getMonth() + 1;
        var myweekday = date.getDate();

        if (mymonth < 10) {
            mymonth = "0" + mymonth;
        }
        if (myweekday < 10) {
            myweekday = "0" + myweekday;
        }
        return (myyear + "-" + mymonth + "-" + myweekday);
    }

    whhtu = function (time1) {
        var now = new Date();
        var time = now.getTime();
       time1 = (now.getTime()-(7*24*3600*1000));
        var datas = {
            'start': new Date(time1),
            'end': new Date(),
            'area': null,
            'type': null
        }
        $.ajax({
            type: "GET",
            url: "/djt/harmless/whhtu",
            data: datas,
            dataType: "json",
            success: function (data) {
                var unit = "";
                var d = new Date(time1);
                var d2 = new Date();
                var d3 = d2.getTime() - d.getTime();
                if (d3 < (8 * 24 * 3600 * 1000)) {
                    unit = "日";
                } else if (d3 < (60 * 24 * 3600 * 1000)) {
                    unit = "周";
                } else {
                    unit = "月";
                }
                var date = new Array();
                var other = new Array();
                var fajiao = new Array();
                var yanmai = new Array();
                var huazhi = new Array();
                var fenshao = new Array();
                var jizhong = new Array();
                var heji = new Array();
                /*
                 1: '集中处理',
                 2: '焚烧',
                 3: '化制',
                 4: '掩埋',
                 5: '发酵',
                 6: '其它',*/
                $.each(data, function (index, item) {
                    var count = index+1;
                    var now = "第" + count + unit + ",";
                    for (var key in item) {
                        var ji = 0;
                        var fen = 0;
                        var hu = 0;
                        var ya = 0;
                        var fa = 0;
                        var ot = 0;
                        for(var prop in item[key]){
                            if (prop == 1) {
                                ji+=Number(item[key][prop]);

                            } else {
                                ji+=Number(0);

                            }
                            if (prop == 2) {
                                fen+=Number(item[key][prop]);

                            } else {
                                fen+=0;

                            }
                            if (prop == 3) {
                                hu+=Number(item[key][prop]);

                            } else {
                                hu+=0;

                            }
                            if (prop == 4) {
                                ya+=Number(item[key][prop]);

                            } else {
                                ya+=0;

                            }
                            if (prop == 5) {
                                fa+=Number(item[key][prop]);

                            } else {
                                fa+=0;
                            }
                            if (prop == 6) {
                                ot+=Number(item[key][prop]);

                            } else {
                                ot+=0;
                            }

                        }
                        jizhong.push(ji);
                        fenshao.push(fen);
                        huazhi.push(hu);
                        yanmai.push(ya);
                        fajiao.push(fa);
                        other.push(ot);
                        var num = Number(jizhong[index])+Number(fenshao[index])+Number(huazhi[index])+Number(yanmai[index])+Number(fajiao[index])+Number(other[index]);
                        heji.push(num);
                    }
                    date.push(now);
                })


                var harmlessChart = echarts.init(document.getElementById('harmlessChart'));
                option = {

                    tooltip: {
                        trigger: 'axis'
                    },
                    legend: {
                        data: ['合计总数', '集中处理', '焚烧', '化制', '掩埋', '发酵', '其它'],
                        selected: {
                            '集中处理': false, '焚烧': false, '化制': false, '掩埋': false, '发酵': false, '其它': false
                        }
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    toolbox: {
                        feature: {
                            saveAsImage: {}
                        }
                    },
                    xAxis: {
                        type: 'category',
                        boundaryGap: false,
                        data: date
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [
                        {
                            name: '合计总数',
                            type: 'line',

                            data: heji

                        },
                        {
                            name: '集中处理',
                            type: 'line',

                            data: jizhong

                        },
                        {
                            name: '焚烧',
                            type: 'line',

                            data: fenshao
                        },
                        {
                            name: '化制',
                            type: 'line',

                            data: huazhi
                        },
                        {
                            name: '掩埋',
                            type: 'line',

                            data: yanmai
                        },
                        {
                            name: '发酵',
                            type: 'line',

                            data: fajiao
                        }
                        ,
                        {
                            name: '其它',
                            type: 'line',

                            data: other

                        }
                    ]
                };
                harmlessChart.setOption(option);

            }

        })
    }


</script>
<script type="text/javascript">
    //格式化日期：yyyy-MM-dd

    function numzb(num1, num2) {
        if (num2 == 0) {
            return 0;
        }
        var i = Number(num1);
        var m = Number(num2);
        var result = i / m;
        return Math.round(result*100);
    }

    function color(num) {
        if (Number(num) > 0) {
            return "text-right color-success"
        }
        if (Number(num) == 0) {
            return "text-right color-primary"
        }
        if (Number(num) < 0) {
            return "text-right color-danger"
        }
    }

    function jt(num) {
        if (Number(num) > 0) {
            return "fa fa-angle-up"
        }
        if (Number(num) == 0) {
            return "fa fa-angle-right"
        }
        if (Number(num) < 0) {
            return "fa fa-angle-down"
        }
    }
    cdjy = function (time1) {
        if (time1 == null || time1 == "") {
            var now = new Date();
            if (now.getMonth() == 0) {
                time1 = formatDate(new Date(now.getFullYear() - 1, 11, 1));
            } else {
                time1 = formatDate(new Date(now.getFullYear(), now.getMonth() - 1, 1));
            }
        }

        var datas = {
            'start': new Date(time1),
            'end': new Date()
        }
        $.ajax({
            type: "GET",
            url: "/djt/quarantine/cdjy",
            data: datas,
            dataType: "json",
            success: function (data) {
                $.each(data, function (index, item) {
                    $("#jyshenqing").text(num2(item.ranking));
                    $("#dwshuliang").text(num2(item.num));
                    $("#qualified").text(num2(item.qualified));
                    $("#unqualified").text(num2(item.unqualified));
                    $("#bdtuzai").text(num2(item.islocal));
                    $("#wsshuliang").text(num2(item.notlocal));
                    $("#jytb").text(num2(item.rankingt) * 100 + "%");
                    $("#dwtb").text(num2(item.numt) * 100 + "%");
                    $("#bdtb").text(num2(item.islocalt) * 100 + "%");
                    $("#wstb").text(num2(item.notlocalt) * 100 + "%");
                    $("#qutb").text(num2(item.qualifiedt) * 100 + "%");
                    $("#untb").text(num2(item.unqualifiedt)* 100 + "%");
                    $("#jyhb").text(num2(item.rankingh) * 100 + "%");
                    $("#dwhb").text(num2(item.numh) * 100 + "%");
                    $("#bdhb").text(num2(item.islocalh) * 100 + "%");
                    $("#wshb").text(num2(item.notlocalh) * 100 + "%");
                    $("#quhb").text(num2(item.qualifiedh) * 100 + "%");
                    $("#unhb").text(num2(item.unqualifiedh) * 100 + "%");

                    $("#bdzb").text(numzb(item.islocal, item.num)  + "%");
                    $("#wszb").text(numzb(item.notlocal, item.num)  + "%");
                    $("#hgzb").text(numzb(item.qualified, item.num)  + "%");
                    $("#unzb").text(numzb(item.unqualified, item.num)  + "%");

                    $("#bdclass").attr("class", jt(item.islocalh));
                    $("#wsclass").attr("class", jt(item.notlocalh));
                    $("#hgclass").attr("class", jt(item.qualifiedh));
                    $("#bhgclass").attr("class", jt(item.unqualifiedh));

                    $("#bdcolor").attr("class", color(item.islocalh));
                    $("#wscolor").attr("class", color(item.notlocalh));
                    $("#hgcolor").attr("class", color(item.qualifiedh));
                    $("#bhgcolor").attr("class", color(item.unqualifiedh));

                })
            }

        })
    }
    function num2( num) {
        if (num == 0) {
            return 0;
        }
        var i = Number(num);


        return Math.round(i);
    }

    tzjy = function (time1) {
        if (time1 == null || time1 == "") {
            var now = new Date();
            if (now.getMonth() == 0) {
                time1 = formatDate(new Date(now.getFullYear() - 1, 11, 1));
            } else {
                time1 = formatDate(new Date(now.getFullYear(), now.getMonth() - 1, 1));
            }
        }

        var datas = {
            'start': new Date(time1),
            'end': new Date()
        }

        $.ajax({
            type: "GET",
            url: "/djt/quarantine/tzjy",
            data: datas,
            dataType: "json",
            success: function (data) {
                $.each(data, function (index, item) {
                    $("#tzsq").text(item.ranking);
                    $("#tzshuliang").text(item.num);
                    $("#bdtz").text(item.islocal);
                    $("#wdrc").text(item.notlocal);
                    $("#tzhg").text(item.qualified);
                    $("#tzbhg").text(item.unqualified);
                    $("#tzbdtb").text(item.islocalt * 100 + "%");
                    $("#tzwdtb").text(item.notlocalt * 100 + "%");
                    $("#tzhgtb").text(item.qualifiedt * 100 + "%");
                    $("#tzbhgtb").text(item.unqualifiedt * 100 + "%");
                    $("#tzbdhb").text(item.islocalh * 100 + "%");
                    $("#tzwdhb").text(item.notlocalh * 100 + "%");
                    $("#tzhghb").text(item.qualifiedh * 100 + "%");
                    $("#tzbhghb").text(item.unqualifiedh * 100 + "%");

                    $("#tzbdzb").text(numzb(item.islocal, item.num) * 100 + "%");
                    $("#tzwdzb").text(numzb(item.notlocal, item.num) * 100 + "%");
                    $("#tzhgzb").text(numzb(item.qualified, item.num) * 100 + "%");
                    $("#tzbhgzb").text(numzb(item.unqualified, item.num) * 100 + "%");

                    $("#tzbdclass").attr("class", jt(item.islocalh));
                    $("#tzwdclass").attr("class", jt(item.notlocalh));
                    $("#tzhgclass").attr("class", jt(item.qualifiedh));
                    $("#tzbhgclass").attr("class", jt(item.unqualifiedh));

                    $("#tzbdcolor").attr("class", color(item.islocalh));
                    $("#tzwdcolor").attr("class", color(item.notlocalh));
                    $("#tzhgcolor").attr("class", color(item.qualifiedh));
                    $("#tzbhgcolor").attr("class", color(item.unqualifiedh));

                })
            }

        })
    }


    //排行
    $(function () {


        (function () {
            whhtu(null);
            cdjy(null);
            tzjy(null);
            $("#cdjysearch").click(function () {
                cdjy(null);
            });
            $("#cdday").click(function () {
                var now = new Date();
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), now.getDate()));
                cdjy(new Date(time1));
            })

            $("#cdweek").click(function () {
                var now = new Date();
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay()));
                cdjy(new Date(time1));
            })
            $("#cdmonth").click(function () {
                var now = new Date();
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), 1));
                cdjy(new Date(time1));
            })
            $("#tzday").click(function () {
                var now = new Date();
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), now.getDate()));
                tzjy(new Date(time1));
            })
            $("#tzweek").click(function () {
                var now = new Date()
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), now.getDate() - now.getDay()));
                tzjy(new Date(time1));
            })
            $("#tzmonth").click(function () {
                var now = new Date()
                var time1 = formatDate(new Date(now.getFullYear(), now.getMonth(), 1));
                tzjy(new Date(time1));
            })

        })()


    })
</script>
<script type="text/javascript">


</script>

</body>
</html>
